package org.keyroy.app.puzzle_rpg.views;

import org.keyroy.app.puzzle_rpg.models.Map;
import org.keyroy.app.puzzle_rpg.models.Puzzle;

import android.content.Context;
import android.view.Gravity;
import android.widget.FrameLayout;

public class GameWindow extends FrameLayout {

	private Map map;
	private PuzzleView puzzleView;

	public GameWindow(Context context) {
		super(context);
		newPuzzle();
	}

	public void newPuzzle() {
		Puzzle.random();
		map = new Map(6, 8, 80, 80);
		Puzzle.fill(map);

		removeAllViews();
		LayoutParams params = new LayoutParams(map.getWidth(), map.getHeight());
		params.gravity = Gravity.CENTER;

		puzzleView = new PuzzleView(getContext(), map);
		addView(puzzleView, params);
	}

	public void reflush() {
		puzzleView.reflush();
	}

	public void tip() {
		puzzleView.tips();
	}
}
